<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        label {
            display: inline-block;
            width: 30px;
            height: 30px;
            border: 1px solid #000;
        }

        input:checked+label {
            background-color: #f00;
        }
    </style>
</head>

<body>

    <!-- 必须有input  可以实现点击效果   视觉上不需要input显示(样式无法修改) -->

    <input type="checkbox" id="c1" hidden>
    <label for="c1"></label>

    <input type="checkbox" id="c2" hidden>
    <label for="c2"></label>

    <input type="checkbox" id="c3" hidden>
    <label for="c3"></label>

</body>

</html>